//react核心库1
import { StrictMode } from 'react';
import ReactDOM from 'react-dom/client';
//根组件和样式
// import App from './App.tsx'
import './index.less';
//redux
import { Provider } from 'react-redux';
import store from '@/redux';
import { setScreenWidth, setScreenHeight } from './redux/modules/screen';
//react-router
import { BrowserRouter } from 'react-router-dom';
import { ConfigProvider } from 'antd';
import Routes from '@/router';

import { debounce } from 'lodash';

//监听屏幕宽高
const handleResize = debounce(() => {
  store.dispatch(setScreenWidth(window.innerWidth));
  store.dispatch(setScreenHeight(window.innerHeight));
}, 200); //消抖处理
window.addEventListener('resize', handleResize);
handleResize();

ReactDOM.createRoot(document.getElementById('root')!).render(
  // <StrictMode>
  <ConfigProvider
    theme={{
      components: {
        Menu: {
          darkItemBg: '#101113',
          darkItemSelectedBg: '#2d2e31',
        },
      },
    }}
  >
    <Provider store={store}>
      <BrowserRouter>
        {/* <App /> */}
        <Routes />
      </BrowserRouter>
    </Provider>
  </ConfigProvider>,
  // </StrictMode>,
);
